$(function() {
  $(".login-form").on("submit", function(e) {
    e.preventDefault();
    $.ajax({
      url: "/login",
      method: "post",
      data: {
        username: $(".username").val(),
        password: $(".password").val()
      },
      success: function(data) {
        //console.log(data);
        if ((data.status = -1)) {
          localStorage.setItem("username", $(".username").val());
          window.location.href = data.goto;
        }
      }
    });
  });
});
